package com.dfbz.demo01_类加载器的使用;

import org.junit.Test;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo01_类何时被加载 {

    @Test
    public void test1() throws ClassNotFoundException {
//        new B();          // 先加载A再加载B

        Integer num = B.num;        // 先加载A再加载B

//        Class<?> clazz = Class.forName("com.dfbz.demo01_类加载器的使用.B");        // 先加载A再加载B
    }
}

class A {
    public static Integer num = 10;

    static {
        System.out.println("A loader...");
    }
}

class B extends A {

    public static Integer num = 20;

    static {
        System.out.println("B loader...");
    }
}
